package org.brunoc.searchstores4j.util;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.cookie.CookiePolicy;

/**
 * Default HttpClient Factory. The API utilizes this singleton to keep just one HttpClient
 * The main reason to have a Singleton for the client is to keep cookies at the same API session.
 * @author Bruno Candido Volpato da Cunha
 *
 */
public class HttpClientFactory {

	private static HttpClient client;
	
	public static HttpClient getInstance() {
		if (client == null) {
			client = new HttpClient();
			client.getParams().setCookiePolicy(CookiePolicy.NETSCAPE);
		}
		
		return client;
	}

	
	
}
